package main

import (
	"fmt"
	"net/http"
)

func main() {
	// http 路径匹配响应方法
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprint(w, "Welcome to my Website.")
	})

	// http 文件服务器
	fs := http.FileServer(http.Dir("static/"))

	// http 文件路径映射到文件服务请求
	http.Handle("/static/", http.StripPrefix("/static/", fs))

	fmt.Println("http server Listen at: http://localhost:80")

	// 启用http服务监听
	http.ListenAndServe(":80", nil)
}
